import { createRouter, createWebHashHistory } from 'vue-router'
const routes = [
	{
		path: '/',
		redirect: '/home'
	},
	{
		name: 'home',
		path: '/home',
		component: () => import('../pages/home.vue')
	},
	{
		name: '404',
		path: '/404',
		component: () => import('../pages/404.vue')
	},
	// 匹配任意路由
	{
		path: '/:pathMatch(.*)*',
		redirect: '/404'
	}
]
const router = createRouter({
	scrollBehavior: () => ({ left: 0, top: 0 }),
	history: createWebHashHistory(),
	routes
})

// router.beforeEach((to, from, next) => {
// 	next()
// })

export default router
